<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>装饰器</title>
</head>
<body>
  
</body>
<script>
  function Info(target) {
    target.prototype.showInfo = function() {
      console.log('书本信息')
    }
  }
  @Info()
  class Book {
    constructor(name, sale) {
      this.name = name
      this.sale = sale
    }
  }

  const book = new Book('javascript', 21)
  console.log(book)
</script>
</html>